package com.example.financechain.controller;


import com.alibaba.fastjson.JSON;
import com.example.financechain.Utils.JsonData;
import com.example.financechain.Utils.UserThreadLocal;
import com.example.financechain.common.cache.Cache;
import com.example.financechain.domain.VO.MenuVo;
import com.example.financechain.domain.entity.Menu;
import com.example.financechain.domain.entity.Role;
import com.example.financechain.mapper.MenuMapper;
import com.example.financechain.service.IMenuService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * <p>
 * 菜单权限表 前端控制器
 * </p>
 *
 * @author yy
 * @since 2023-04-13
 */
@RestController
@RequestMapping("private/menu")
public class MenuController {


    @Autowired
    private IMenuService menuService;


    /**
     * 构建用户权限菜单栏
     * @return
     */
    @GetMapping()
    //@Cache(expire = 10*60*1000 , name = "roleMenu")
    public JsonData queryrout(){

        List<MenuVo> buildmenu = menuService.buildmenu();
        return JsonData.buildSuccess(buildmenu);

    }

}
